/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.thotheolh.xbase.data;

import java.util.ArrayList;
import org.thotheolh.xbase.data.meta.MetaType;

/**
 *
 * @author thotheolh
 */
public class DataCollection {

    private ArrayList<DataElement> dataList = new ArrayList<>();

    public DataCollection() {
    }

    public DataCollection(ArrayList<DataElement> dataList) {
        setDataList(dataList);
    }
    
    public void emptyAllElements() {
        dataList = new ArrayList<>();
    }
    
    public void addElement(DataElement element) {
        dataList.add(element);
    }
    
    public void addElement(MetaType type, Object item) {
        dataList.add(new DataElement(type, item));
    }
    
    public void removeElement(DataElement element) {
        dataList.remove(element);
    }
    
    public void removeElement(int pos) {
        dataList.remove(pos);
    }

    public int size() {
        return dataList.size();
    }
    
    public DataElement get(int pos) {
        return dataList.get(pos);
    }
    
    /**
     * @return the dataList
     */
    public ArrayList<DataElement> getDataList() {
        return dataList;
    }

    /**
     * @param dataList the dataList to set
     */
    public void setDataList(ArrayList<DataElement> dataList) {
        this.dataList = dataList;
    }
}
